<!DOCTYPE html>
<html>
  <head>
    <meta charset="UTF-8">
    <title>Document</title>
  </head>
  <body>
    <p>请选择你最喜欢的水果（多选）</p>
    <label><input type="checkbox" name="fruit" value="苹果">苹果</label>
    <label><input type="checkbox" name="fruit" value="香蕉">香蕉</label>
    <label><input type="checkbox" name="fruit" value="西瓜">西瓜</label>
    <script>
      var fruits = document.getElementsByName('fruit');
      fruits[0].checked = true;
    </script>
  </body>
</html>